<div class="proedit">
	<form action="<?php echo url('ad/edit');?>" method="post" id="editForm">
		<table>
			<tr>
				<td width="80" class="inputtxt" align="right"><span>标题</span></td>
				<td align="left">
					<input type="text" class="required" name="ad[title]" value="<?php echo $ad['title'];?>" />
				</td>
			</tr>
			<tr>
				<td class="inputtxt" align="right"><span>位置</span></td>
				<td align="left">
					<select id="selectType" name='ad[type]'>
						<option <?php if(service_type::ADSIDEBAR==$ad['type']) echo "selected='selected'";?> value="<?php echo service_type::ADSIDEBAR;?>">
							<?php echo service_type::getName(service_type::ADSIDEBAR);?>
						</option>
						<option <?php if(service_type::ADMIDDLE==$ad['type']) echo "selected='selected'";?> value="<?php echo service_type::ADMIDDLE;?>">	
							<?php echo service_type::getName(service_type::ADMIDDLE);?>
						</option>
					</select>
					<div id="showSize"></div>
				</td>
			</tr>
			<tr>
				<td class="inputtxt" align="right"><span>链接</span></td>
				<td align="left"><input type="text" name="ad[url]" value="<?php echo $ad['url'];?>"</td>
			</tr>
			<tr>
				<td class="inputtxt" align="right"><span>图片</span></td>
				<td align="left"><?php echo fetch('uploadImg');?></td>
			</tr>
			<tr align="right"><td colspan="2"><input type="submit" value="修改" id="catesub" /></td></tr>
		</table>
		<input type="hidden" name="id" value="<?php echo $ad['id'];?>" />
	</form>
</div>
<script type="text/javascript">
$(document).ready(function(){
	$("#selectType").change(function(){
		val = $(this).val();
		if(val=="<?php echo service_type::ADSIDEBAR;?>"){
			$("#showSize").html("图片的大小为100X400");
		}else if(val=="<?php echo service_type::ADMIDDLE;?>"){
			$("#showSize").html("图片的大小为930X50");	
		}
	});
	$("#selectType").change();
		$("#wBox .wBox_body").css("width","330");
	submitForm("#editForm",{
		dataType:'json',
		success:function(data){
				if(data.i=='ok'){
					location.href="<?php echo url('ad/index');?>";
				}else{
					alert(data.i);
				}
			},
	});
});
</script>
